package com.xbfinal.email.controller;

import com.xbfinal.commonUtils.Result;
import com.xbfinal.email.service.MsmService;
import com.xbfinal.email.utils.RandomUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * @Title: EmailController
 * @Author 笑霸fianl
 * @Package com.xbfinal.email.controller
 * @Date 2023/2/28 9:18
 * @描述: 邮件登录 替代 短信登录
 */
@RestController
@RequestMapping("edumsm/msm")
@Slf4j
@Api("邮件服务")
public class EmailController {

    @Autowired
    private MsmService msmService;

    @GetMapping("send/{phone}")
    public Result sendPhone(@PathVariable("phone") String phone){

        boolean isSend = msmService.send(phone);

    if (!isSend){
        return Result.failed().addData("发送失败");
    }

        return Result.ok().addData("发送成功");
    }
}
